package com.neusoft.servlet;

import com.alibaba.fastjson.JSON;
import com.neusoft.model.Profile;
import com.neusoft.model.ProfileInfo;
import com.neusoft.model.Tag;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;

@WebServlet("/hello")
public class ProfileServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
//        Profile profile = new Profile();
//        profile.setUsername("张三");
//        profile.setBio("one person");
//        profile.setFollowing(true);
//        profile.setImage("http://a.jpg");
//
//        ProfileInfo profileInfo = new ProfileInfo();
//        profileInfo.setProfile(profile);

        Tag tag = new Tag();
        List<String> lst = new ArrayList<String>();
        lst.add("java");
        lst.add("python");
        tag.setTags(lst);

        String jsonResult = JSON.toJSONString(tag);
        PrintWriter writer = resp.getWriter();
        writer.println(jsonResult);
    }
}
